/* 002.c */

.LC0:
	.string "please input the decimalism number(0-32767):\n"
	
.LC1:
	.string "%d"
	
.LC2:
	.string " "

.globl _main

_main:
	pushl %ebp
	movl %esp,%ebp
	subl $0x1000,%esp
	
	movl $0,-0x1000(%ebp) /* i */
	movl $0,-0xffc(%ebp) /* j */
	movl $0,-0xff8(%ebp) /* n */
	movl $0,-0xff4(%ebp) /* m */
	
	movl $0,-0xff0(%ebp) /* a */
	
	movl $16,%eax
	sall $2,%eax 
	pushl %eax 
	movl $0,%eax
	pushl %eax 
	leal -0xff0(%ebp),%eax
	pushl %eax 
	call _memset 
	
	pushl $.LC0 
	movl $0,%eax 
	call _printf 
	
	leal -0xff8(%ebp),%eax
	pushl %eax
	pushl $.LC1
	movl $0,%eax 
	call _scanf 

	movl $0,-0xff4(%ebp) /* m */
	jmp .Lmain_400
	
.Lmain_500:
	movl -0xff8(%ebp),%eax /* n */
	movl $2,%ebx
	xorl %edx,%edx
	idivl %ebx
	movl %edx,-0x1000(%ebp) /* i */
	
	movl -0xff8(%ebp),%eax /* n */
	movl $2,%ebx  
	xorl %edx,%edx
	idivl %ebx
	movl %eax,-0xffc(%ebp) /* j */
	
	movl -0xffc(%ebp),%eax /* j */
	movl %eax,-0xff8(%ebp) /* n */

	movl -0x1000(%ebp),%ecx /* i */

	movl -0xff4(%ebp),%eax /* m */
	sall $2,%eax	
	leal -0xff0(%ebp),%edi /* a */
	movl %ecx,0(%edi,%eax,1) /* a[m] */

	addl $1,-0xff4(%ebp) /* m */
	
.Lmain_400:
	cmpl $15,-0xff4(%ebp) /* m */
	jl .Lmain_500
	
	movl $15,-0xff4(%ebp) /* m */
	jmp .Lmain_300
	
.Lmain_390:
	
	movl -0xff4(%ebp),%eax /* m */
	sall $2,%eax
	leal -0xff0(%ebp),%edi /* a */
	movl 0(%edi,%eax,1),%eax /* a[m] */
	pushl %eax
	pushl $.LC1 
	movl $0,%eax 
	call _printf 
	
	movl -0xff4(%ebp),%eax /* m */
	movl $4,%ebx
	xorl %edx,%edx
	idivl %ebx
	cmpl $0,%edx
	jne .Lmain_350
	
	pushl $.LC2
	movl $0,%eax
	call _printf 
	
.Lmain_350:
	subl $1,-0xff4(%ebp) /* m */
	
.Lmain_300:
	cmpl $0,-0xff4(%ebp) /* m */
	jge .Lmain_390
	
	movl $0,%eax
	leave
	ret
	